/* eslint-disable import/prefer-default-export */
/* eslint-disable class-methods-use-this */
/* eslint-disable no-unused-vars */
/* eslint-disable max-classes-per-file */
import Konva from 'konva'
import { IKonvaPen } from '@/components/konvaUnits/tools/IKonvaPen'
import { useStore } from '@/store/index'

export class EraseTool implements IKonvaPen {
  status: 'waiting' | 'drawing' = 'waiting'

  points!: number[]

  beginPos!: number[]

  endPos!: number[]

  angle: number = 0

  text: number[] = [0]

  beginPillar!: { id: ''; x: 0; y: 0; rotation: 0; width: 0; height: 0 }

  endPillar!: { id: ''; x: 0; y: 0; rotation: 0; width: 0; height: 0 }

  konvaGroup!: Konva.Group

  mousedown(layer: Konva.Layer, points: number[], node: object): void {}

  mousemove(points: number[], node: object): void {}

  mouseup(points: number[], node: object): void {}

  clean(): void {}

  click(layer: Konva.Layer, node: object): void {
    const store = useStore()
    const name = node.attrs.id.split('-')
    layer.findOne(`#${name[0]}`).remove()
    store.drawingAction.removeHistory(name[0])
  }

  dblclick(e: any): void {}
}
